/**
 * Created by jean.h.ma on 05/03/2018.
 */

import React, {Component} from 'react'
import {Route, Switch} from 'react-router-dom'

export const routes = [
	<Route key="index" exact path="/" component={require('./pages/Index').default} title="首页"/>,

	<Route key="TestTODO" exact path="/test/todo" component={require('./pages/test/TODO').default} title="Test-TODO"/>,
	<Route key="TestHttp" exact path="/test/http" component={require('./pages/test/Http').default} title="Test-Http"/>,
	<Route key="TestEvent" exact path="/test/event/:name" component={require('./pages/test/TestEvent').default}
		   title="Test-Event"/>,
	<Route key="TestMathExpression" exact path="/test/math-expression"
		   component={require('./pages/test/MathExpression').default}
		   title="Test-MathExpression"/>,
	<Route key="TestDataTable" exact path="/test/datatable" component={require('./pages/test/TestDataTable').default}
		   title="Test-DataTable"/>,
	<Route key="TestForm" exact path="/test/form" component={require('./pages/test/TestForm').default}
		   title="Test-Form"/>,

	<Route key="test" exact path="/test/hello" component={require("./pages/test/Hello").default} title="Hello"/>,
	<Route key="schedule" exact path="/test/schedule" component={require("./pages/test/schedule").default} title="schedule"/>,
	<Route key="scheduleList" exact path="/test/scheduleList" component={require("./pages/test/scheduleList").default} title="scheduleList"/>
];

export default class Routes extends Component {
	render() {
		return (
			<Switch>
				{routes}
			</Switch>
		);
	}
}

export const RoutePaths = (() => {
	return routes.map(item => {
		return {
			path: item.props.path,
			title: item.props.title
		};
	})
})();